Repository navigation
Conversation
15ab845 to
397b50b
Compare
397b50b to
4b72dd2
Compare
4b72dd2 to
61bb134
Compare
|
@switch87 Nice one! I have not run it on my laser yet (might try later this week), but I did run your PR without machine to try your new function. Would it be an idea to make the Method "Z- axis steps" the default if the machine definition indicates it supports a z-axis? Of course just a nice to have, but I think it would make sense. |
61bb134 to
73ca5b7
Compare
|
@atkaper Good idea, done in 73ca5b7. The method list was already ordered by preference (Z axis steps, manual, ramp) and only contains what the machine supports, but the dialog started on the manual method regardless. It now starts on the first available method, so a machine with a Z axis and a G-code driver opens on Z axis steps. A UI test covers it, and the docs say which method is the default. Also rebased onto current main. |
|
Super! I will try this one later this week! |
|
Dropped the laser_essentials .po/.pot changes from this PR, following your rule of one catalog update before each release; the new strings are still wrapped in |
30c1f09 to
c6814ed
Compare
|
I went over this again against the rest of the code base and pushed two small follow-up commits on top, no force-push:
I also corrected the PR description, which described the ramp and the Interval Test wrongly. |
|
Thank you for this PR! In testing I noticed some issues:
Proposed next phases
Specific design proposal for phase 1 (AI generated but reviewed)
Out of scope (deferred by design): interactive filter editing in the UI, multi-select semantics beyond what generators set. |
|
(I will draft a PR for phase 1, as that was a pre-existing mess so I will clean this up.) |
|
Thanks for testing it this thoroughly and for the detailed plan. I agree on all three points, and the workpiece filter is a much cleaner base than I'll leave phase 1 to you then. Meanwhile I'll write the phase 2 plan, refactoring the Material Test Grid generator so the three tests share one architecture and one UX (dedicated layer, dialog opens immediately and doesn't hide the test, per-cell editable result), and post it here for review before writing any code. I've turned this PR back into a draft so it doesn't sit in your review queue; phase 3 will rebuild these generators on top of the cleaned-up code, including the screenshot targets for the docs. |
Phase 2 plan: one generator architecture for all calibration testsThis plan starts after your phase 1 ( Where things stand today
What all three tests share: a parameter VarSet, a row or grid layout with labels, an ordered list of "cell = workpiece + step" entries (sometimes with commands in between), placement on the work area, one undo entry, and regeneration when a parameter changes. Target shape (all in
|
The values every cell or line of the two new calibration tests is made with: evenly spread line intervals (with their LPI) and focus offsets, the row layout, and the commands the Focus Test puts between its lines: an M0 pause in manual mode, or relative Z moves (G91/G0 Z/G90) that end at the starting height, honouring Reverse Z. Offsets are limited to +/-10 mm. Refs barebaric#519
CalibrationTestCmd creates each test as its own layer. Every cell or line is a vector workpiece with its own step, linked through generated_workpiece_uid like the Material Test Grid, so it stays editable. Interval cells are Engrave steps with constant power and their own line interval; focus lines are Contour steps, with Command steps in between for the manual and Z axis modes. Labels share one workpiece and one low-power contour step that runs first. The test is centered on the work area and added in one undoable step. Golden G-code tests cover the interval pitch per cell, the M0 pauses (always after M5) and the balanced Z moves. Refs barebaric#519
Each entry opens a dialog for the settings, with unit-aware lengths and speeds capped at the machine's maximum. The Focus Test dialog only offers the methods the machine supports and explains the procedure for the chosen one. Refs barebaric#519
The method list is already ordered by preference (Z axis steps, manual, ramp) and only holds what the machine supports, so the dialog now starts on its first entry instead of the manual method. Refs barebaric#519
|
This pull request was closed automatically because its description does not follow the pull request template. Problems found:
Please edit the pull request description to answer every section and to tick every checkbox; as soon as it complies, the pull request is reopened automatically. See CONTRIBUTING.md. |
|
Sorry, bot went wild. Tried to reopen and that is also blocked... ugh. Checking what can be done. |
The Material Test Grid, the Interval Test and the Focus Test now share one architecture and behave the same: - A CalibrationGenerator turns its parameters into a layout: an ordered list of cells (one shape plus the step that processes only that shape) and machine commands between them. Generators do not touch the document. - CalibrationBuilder turns a layout into workpieces, steps and source assets; CalibrationCmd adds them on a new layer named after the test and rebuilds them when a parameter changes, each in one undo step. A rebuilt test keeps its place and stays on the work area. Steps the user added to the layer stay. - A hidden CalibrationRecord asset keeps the generator, its parameters and the uids of what it made, so the test can be rebuilt after saving and loading. A Material Test Grid from an older project gets a record on its first change. - Tools -> Create ... adds the test with default settings and selects it. Its settings show under Test Settings in the item properties panel instead of a modal dialog, so the test stays in view. - The Material Test Grid's grid, label and range settings moved from its step settings to Test Settings, with the presets, the mode-dependent row titles, the Speed vs Offset defaults and the machine speed limit. Its G-code is unchanged. Refs barebaric#519
The material-test target now creates the grid through Tools -> Create Material Test Grid and captures the main window with the Test Settings in the item properties panel, instead of the step settings dialog. New interval-test and focus-test targets do the same for the other two tests, and the Workpieces tab target creates the grid through the new command. Refs barebaric#519
The Interval and Focus Test entry sat under 1.13.0-beta1, which is already released. The changelog is written for each release. Refs barebaric#519
All three calibration tests are created on their own layer and set up under Test Settings in the item properties panel, with every change rebuilt as one undo step. Update the Material Test Grid and the Interval and Focus Tests pages, and their translations, to match. Refs barebaric#519
Workflow.add_children and remove_children went straight to DocItem and skipped the per-step transformer wiring that add_child and set_children do, so a step added in bulk did not report post-processor changes. Doc.remove_asset_by_uid gets a silent flag, like add_asset, for commands that change several assets and notify once. Refs barebaric#519
Rebuilding a test replaced its workpieces, steps and assets with one command per item. Every item made the layers panel and the workflow views rebuild, so a Focus Test with Z axis steps froze the window for about three seconds after each change. RebuildCalibrationCommand now swaps them in bulk with the pipeline paused, as grouping does, which takes under 0.1 s. Cells in a group go back to it on undo. Refs barebaric#519
|
@knipknap A short reminder about the phase 2 plan above. The six open questions are still open. In the meantime I built it locally, following the plan, with these answers:
All three tests now behave the same and share one generator. The Material Test Grid gives the same G-code as before, and old projects with a grid still load and run. Before I push anything: do you agree with these answers? And do you want it as the small PRs from the plan (2.1 to 2.6, then 3.1 and 3.2), or as one update of this PR? The plan promised small PRs, so that is what I'll do unless you prefer otherwise. |
A recipe applied to the Material Test Grid's step changed its grid settings, but the preview kept its size, the Test Settings kept the old values and the next change there dropped the recipe. A rebuild also replaced the step, so the laser head and the post-processing set in its own settings were lost. - A generator can now keep its steps on a rebuild and change only the settings it controls. The grid does, and reads its settings back from the step, where recipes apply them. - CalibrationSync, registered as an editor command, redraws the grid preview when its step's grid settings change, as before the grid got its own layer. - The same command takes a test's record and hidden source assets out of the document with the test's layer and puts them back when the layer returns, so a deleted test leaves nothing behind in the saved project and undo still works. - The Test Settings provider is registered in register_commands instead of on import, so importing the frontend does not add it twice. Refs barebaric#519
A Focus Test made with Z axis steps showed Manual on a machine without a Z axis, and any other change rebuilt it as Manual. The Test Settings now apply only the settings that were changed, list the test's own method even when the machine lacks it, and say that it is not available there. The panel no longer waits on timeouts: a rebuilt test is selected again right away, and a new test's settings are scrolled into view each time the panel's size changes until a setting is edited or another test is selected. Refs barebaric#519
Deleting a test's layer took all of its source assets out of the document, also the one of a cell the user had moved to another layer, which then lost its source. The layer sync now uses the same in-use check as a rebuild. Refs barebaric#519
After a new test was deselected, or another item was selected, the panel kept scrolling to where the Test Settings card had been whenever its size changed. Following now stops as soon as the card is hidden. Refs barebaric#519
Like the sketcher's parameters, the Test Settings now have their own register function. The frontend calls it from rayforge_init instead of register_commands. It still does not run on import, so a module imported under two names does not add a second panel. Refs barebaric#519
A value that made a test invalid stayed in its row but was dropped from the next rebuild, so fixing another setting quietly went back to the old value. It now stays pending until a rebuild takes it or another test is selected. Refs barebaric#519
The Workpieces tab target looked the grid's step up by its index in its layer, but opened the step at that index across all layers. With the grid on its own layer that was another step. It also moves one workpiece onto the grid's layer, so the tab shows a workpiece the grid's step leaves out, as the docs describe. Refs barebaric#519
Regenerate material-test and the Material Test Grid's Workpieces tab, and add interval-test and focus-test to the Interval and Focus Tests page in every language. Refs barebaric#519
|
I pushed the phase 2 work to this PR after all (up to a274314), so you can look at it and CI runs on it. The description is updated. If you'd rather review it as the small PRs from the plan, say so and I'll split it; I already know which files and tests belong to which step. |
What does this PR change?
The Material Test Grid, the Interval Test and the Focus Test now work the same way and share one generator architecture, as you asked in your review of 15/10. This builds on your workpiece filter from 5892810.
G91/G0 Z/G90, back to the start height at the end), Manual (M0before each line) or Ramp (one long line with 10 mm ticks). A new Focus Test uses the first method the machine supports (Focus Test: default the Method to "Z axis steps" when the machine has a Z axis #550). A test made with Z axis steps keeps that method on a machine without a Z axis, and Test Settings say it is not available there.material-test,interval-test,focus-test. The docs have new screenshots from those targets.Fixes #519. Closes #550.
Why did you choose this specific architectural approach?
The pipeline only sees
Step.workpiece_uids. Everything else is inlaser_essentials:calibration/generator.py: aCalibrationGeneratorturns parameters into a layout. It does not touch the document or GTK.calibration/layout.py: a layout is an ordered list of cells (one shape plus the step that processes only that shape) and machine commands between them. List order is run order.calibration/builder.py: makes the workpieces, steps and source assets for a layout, in test coordinates, and moves the whole test into place.commands/calibration_cmd.py:create()andupdate_params()are the only code that changes the document. A rebuild swaps the old items for the new ones in bulk with the pipeline paused, like grouping does.calibration/record.py: a hidden asset stores the generator, the parameters and what was generated. It is saved in the.ryp.widgets/calibration_provider.py: the Test Settings are a property provider, like the sketch parameters. GTK4 can't place a window on Wayland, so a window could still cover the test. The panel never does.In core there is one fix:
Workflow.add_children/remove_childrenskipped the wiring for per-step post-processor changes.Doc.remove_asset_by_uidalso got asilentflag, likeadd_asset.You didn't answer the open questions from the phase 2 plan, so I made these choices. Tell me if you want them different:
Layer.No
.po/.potchanges and no changelog entry.How did you manually test this locally?
I ran the app in a separate headless KWin session with
tests/config, once with and once without a Z axis on the machine:Automated: end-to-end tests in
tests/doceditor/test_calibration_tests.py(G-code goldens, grid against the old way, recipe, undo/redo, save/load, layer deletion), unit and UI tests inrayforge-addon-laser/tests, and the Tools actions in the real main window intests/ui_gtk/doceditor/test_calibration_test_settings.py. Results as CI runs them:pytest -m "not ui and not stress" --ignore=tests/ui_gtk: 7748 passedpytest -m stress: 18 passedpytest -m ui(headless): 1154 passed, 14 skipped (the tests that need an X display)Checklist
this code.